Placing products and commercial advertisements in media files, such as video files, is a well known method for advertising brands. As advertising campaigns become more dynamic and targeted according to their perspective clients, the need to be able to change and update the advertisements appearing in media files becomes more apparent. However, existing art for inserting segments of a captured image in a video file prove to consume significant manual intervention, extensive preparations for this option during the production of the media file or produce poor visual results. There is therefore a need for a system and a method which would enable advertisers to insert the commercial advertisements in media files in a fully automatic seamless manner and in high quality so that the inserted object will not appear to be artificially inserted. The proposed system and method should provide a solution which can be implemented in the post production stages of preparing the media file, both in on-line and in off-line modes.